home *** CD-ROM | disk | FTP | other *** search
/ Leonardo the Inventor / Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso / LEOWINMV / SHARED.DIR / 03073_Script_BUTTON HANDLERS < prev    next >
Text File  |  1996-04-01  |  9KB  |  259 lines

  1. -- -----------------------------------------------------------
  2. -- Handler hiliteButton hilites the button that was clicked
  3. -- and unhilites the button when the mouse button is released.
  4.  
  5. -- NOTE: THIS IS THE OLD VERSION: THAT HILITE THE BUTTON USING
  6. -- CAST NAMES.
  7. --on hiliteButton stopSound1Flag, stopSound2Flag
  8. --  global hilitedButtonSprite, hilitedButtonOriginalCast
  9. --  
  10. --  put the clickon into hilitedButtonSprite
  11. --  put the castNum of sprite hilitedButtonSprite into hilitedButtonOriginalCast
  12. --  put (the name of cast hilitedButtonOriginalCast) & " Hilited" into HilitedCastName
  13. --  
  14. --  puppetSprite hilitedButtonSprite, true
  15. --  set the castNum of sprite hilitedButtonSprite to the number of cast HilitedCastName
  16. --  
  17. --  -- stopSound1Flag and stopSound2Flag were added because the music
  18. --  -- in sound channel 2 were stopping:
  19. --  -- 1) in the gallery movie when clicking the continue button
  20. --  -- 2) when clicking the copy button
  21. --  -- 3) when clicking the print button
  22. --  -- (ie when clicking a button that stayed in the same movie and music was playing
  23. --  -- in sound channel 2)
  24. --  if voidP(stopSound1Flag) or (stopSound1Flag = 1) then sound stop 1
  25. --  if voidP(stopSound2Flag) or (stopSound2Flag = 1) then sound stop 2
  26. --  
  27. --  puppetTransition 0
  28. --  updateStage
  29. --  
  30. --  repeat while the mouseDown
  31. --    nothing
  32. --  end repeat
  33. --  
  34. --  unhiliteButton
  35. --end
  36.  
  37.  
  38. -- NOTE: THIS IS THE NEW VERSION: THAT HILITE THE BUTTON USING
  39. -- CAST NUMBERS.
  40. on hiliteButton stopSound1Flag, stopSound2Flag
  41.   global hilitedButtonSprite, hilitedButtonOriginalCast
  42.   
  43.   put the clickon into hilitedButtonSprite
  44.   put the castNum of sprite hilitedButtonSprite into hilitedButtonOriginalCast
  45.   set oldCastName = the name of cast hilitedButtonOriginalCast
  46.   set HilitedCastName = getHilitedCastNumber(oldCastName)
  47.   
  48.   puppetSprite hilitedButtonSprite, true
  49.   set the castNum of sprite hilitedButtonSprite = HilitedCastName
  50.   
  51.   -- stopSound1Flag and stopSound2Flag were added because the music
  52.   -- in sound channel 2 were stopping:
  53.   -- 1) in the gallery movie when clicking the continue button
  54.   -- 2) when clicking the copy button
  55.   -- 3) when clicking the print button
  56.   -- (ie when clicking a button that stayed in the same movie and music was playing
  57.   -- in sound channel 2)
  58.   if voidP(stopSound1Flag) or (stopSound1Flag = 1) then sound stop 1
  59.   if voidP(stopSound2Flag) or (stopSound2Flag = 1) then sound stop 2
  60.   
  61.   puppetTransition 0
  62.   updateStage
  63.   
  64.   repeat while the mouseDown
  65.     nothing
  66.   end repeat
  67.   
  68.   unhiliteButton
  69. end
  70.  
  71. -- -----------------------------------------------------------
  72. -- Handler hiliteButtonKeepHilited hilites the button that was
  73. -- clicked and does not unhilite the button.
  74.  
  75. -- NOTE: THIS IS THE OLD VERSION: THAT HILITE THE BUTTON USING
  76. -- CAST NAMES.
  77. --on hiliteButtonKeepHilited stopSound1Flag, stopSound2Flag
  78. --  global hilitedButtonSprite, hilitedButtonOriginalCast
  79. --  
  80. --  put the clickon into hilitedButtonSprite
  81. --  put the castNum of sprite hilitedButtonSprite into hilitedButtonOriginalCast
  82. --  put (the name of cast hilitedButtonOriginalCast) & " Hilited" into HilitedCastName
  83. --  
  84. --  puppetSprite hilitedButtonSprite, true
  85. --  set the castNum of sprite hilitedButtonSprite to the number of cast HilitedCastName
  86. --  
  87. --  -- stopSound1Flag and stopSound2Flag were added because the music
  88. --  -- in sound channel 2 were stopping:
  89. --  -- 1) in the gallery movie when clicking the continue button
  90. --  -- 2) when clicking the copy button
  91. --  -- 3) when clicking the print button
  92. --  -- (ie when clicking a button that stayed in the same movie and music was playing
  93. --  -- in sound channel 2)
  94. --  if voidP(stopSound1Flag) or (stopSound1Flag = 1) then sound stop 1
  95. --  if voidP(stopSound2Flag) or (stopSound2Flag = 1) then sound stop 2
  96. --  
  97. --  puppetTransition 0
  98. --  updateStage
  99. --end
  100.  
  101. -- NOTE: THIS IS THE NEW VERSION: THAT HILITE THE BUTTON USING
  102. -- CAST NUMBERS.
  103. on hiliteButtonKeepHilited stopSound1Flag, stopSound2Flag
  104.   global hilitedButtonSprite, hilitedButtonOriginalCast
  105.   
  106.   put the clickon into hilitedButtonSprite
  107.   put the castNum of sprite hilitedButtonSprite into hilitedButtonOriginalCast
  108.   set oldCastName = the name of cast hilitedButtonOriginalCast
  109.   set HilitedCastName = getHilitedCastNumber(oldCastName)
  110.   
  111.   puppetSprite hilitedButtonSprite, true
  112.   set the castNum of sprite hilitedButtonSprite to the number of cast HilitedCastName
  113.   
  114.   -- stopSound1Flag and stopSound2Flag were added because the music
  115.   -- in sound channel 2 were stopping:
  116.   -- 1) in the gallery movie when clicking the continue button
  117.   -- 2) when clicking the copy button
  118.   -- 3) when clicking the print button
  119.   -- (ie when clicking a button that stayed in the same movie and music was playing
  120.   -- in sound channel 2)
  121.   if voidP(stopSound1Flag) or (stopSound1Flag = 1) then sound stop 1
  122.   if voidP(stopSound2Flag) or (stopSound2Flag = 1) then sound stop 2
  123.   
  124.   puppetTransition 0
  125.   updateStage
  126. end
  127.  
  128. -- -----------------------------------------------------------
  129. -- Handler unhiliteButton unhilites the button that was clicked.
  130.  
  131. -- NOTE: THIS IS THE OLD VERSION: IT TAKES THE NUMBER OF CAST HILITEDBUTTONORIGINALCAST
  132. -- WHEN THISVARIABLE IS ITSELF ALREADY A NUMBER
  133. --on unhiliteButton
  134. --  global hilitedButtonSprite, hilitedButtonOriginalCast
  135. --  
  136. --  set the castNum of sprite hilitedButtonSprite = the number of cast hilitedButtonOriginalCast
  137. --  puppetSprite hilitedButtonSprite, false
  138. --  puppetTransition 0
  139. --  updateStage
  140. --end
  141.  
  142. -- NOTE: THIS IS THE NEW VERSION: IT USES HILITEDBUTTONORIGINALCAST
  143. -- AS A NUMBER
  144. on unhiliteButton
  145.   global hilitedButtonSprite, hilitedButtonOriginalCast
  146.   
  147.   set the castNum of sprite hilitedButtonSprite = hilitedButtonOriginalCast
  148.   puppetSprite hilitedButtonSprite, false
  149.   puppetTransition 0
  150.   updateStage
  151. end
  152.  
  153. -- -----------------------------------------------------------
  154. -- Handler hiliteMe hilites the clicked button by changing the
  155. -- button's cast to the given cast.
  156.  
  157. on hiliteMe HilitedCastName
  158.   put the clickon into whichSprite
  159.   put the castNum of sprite whichSprite into originalCast
  160.   set the castNum of sprite whichSprite to the number of cast HilitedCastName
  161.   updateStage
  162. end
  163.  
  164. -- -----------------------------------------------------------
  165. -- Handler getHilitedCastNumber returns the number of the cast
  166. -- that is the hilited cast of the given unHilitedCatName.
  167.  
  168. on getHilitedCastNumber unHilitedCastName
  169.   global smallBtnNoScriptHilited
  170.   global greyBtnHilited
  171.   global smallBtnHilited
  172.   global largeButtonHilited
  173.   global mediumButtonHilite
  174.   global replayHilited
  175.   global greyPrintBtnHilited
  176.   global PrintBtnHilited
  177.   global CopyBtnHilited
  178.   global InventBtnHilited
  179.   global QuitBtnHilited
  180.   
  181.   
  182.   if (unHilitedCastName = "Small Btn NO SCRIPT") then
  183.     return smallBtnNoScriptHilited
  184.   else if (unHilitedCastName = "Grey btn") then
  185.     return greyBtnHilited
  186.   else if (unHilitedCastName = "Small Btn") then
  187.     return smallBtnHilited
  188.   else if (unHilitedCastName = "Large Button") then
  189.     return largeButtonHilited
  190.   else if (unHilitedCastName = "Medium Button") then
  191.     return mediumButtonHilite
  192.   else if (unHilitedCastName = "Replay") then
  193.     return replayHilited
  194.   else if (unHilitedCastName = "Grey Print btn") then
  195.     return greyPrintBtnHilited
  196.   else if (unHilitedCastName = "Print btn") then
  197.     return PrintBtnHilited
  198.   else if (unHilitedCastName = "Copy btn") then
  199.     return CopyBtnHilited
  200.   else if (unHilitedCastName = "Invent btn") then
  201.     return InventBtnHilited
  202.   else if (unHilitedCastName = "Quit btn") then
  203.     return QuitBtnHilited
  204.   else -- to work with the old method in cast something was left out
  205.     return the number of cast (unHilitedCastName && "Hilited")
  206.   end if
  207. end
  208.  
  209. -- -----------------------------------------------------------
  210. -- Handler clickedButton ???
  211.  
  212. on clickedButton whichSprite -- currently unused
  213.   waitCursor
  214. end
  215.  
  216. -- -----------------------------------------------------------
  217. -- Handler doClickContentsButton is called when the user clicks
  218. -- the contents button (directory 4 change because both the sprite
  219. -- script and the cast script are not performed in director 4 as
  220. -- they are in director 3)
  221.  
  222. on doClickContentsButton
  223.   hiliteButton
  224.   goMain
  225. end
  226.  
  227. -- -----------------------------------------------------------
  228. -- Handler doClickIndexButton is called when the user clicks
  229. -- the index button (directory 4 change because both the sprite
  230. -- script and the cast script are not performed in director 4 as
  231. -- they are in director 3)
  232.  
  233. on doClickIndexButton
  234.   hiliteButton
  235.   goIndex
  236. end
  237.  
  238. -- -----------------------------------------------------------
  239. -- Handler doClickHelpButton is called when the user clicks
  240. -- the help button (directory 4 change because both the sprite
  241. -- script and the cast script are not performed in director 4 as
  242. -- they are in director 3)
  243.  
  244. on doClickHelpButton
  245.   hiliteButton
  246.   goHelp
  247. end
  248.  
  249. -- -----------------------------------------------------------
  250. -- Handler doClickQuitButton is called when the user clicks
  251. -- the quit button (directory 4 change because both the sprite
  252. -- script and the cast script are not performed in director 4 as
  253. -- they are in director 3)
  254.  
  255. on doClickQuitButton
  256.   hiliteButton
  257.   doQuit
  258. end
  259.